import java.util.*;

/**
 * @author LKQ
 * @date 2022/3/31 15:15
 * @description 思路1：N数据不大，将其转为一维数组保存，然后sort
 */
public class Solution {
    public static void main(String[] args) {

    }
    public int kthSmallest(int[][] matrix, int k) {
        int n = matrix.length;
        int[] ma = new int[n * n];
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                ma[i * n + j] = matrix[i][j];
            }
        }
        Arrays.sort(ma);
        return ma[k-1];
    }
}
